﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyTest
{
    public class MenuLink
    {
        private string FindBy { get; set; }
        private Focus Focus {get; set; }
        private MenuLink ParentMenu { get; set; }
        public MenuLink(string findBy, Focus focus, MenuLink parentMenu)
        {
            FindBy = findBy;
            Focus = focus;
            ParentMenu = parentMenu;
        }
        public MenuLink(string findBy, Focus focus)
        {
            FindBy = findBy;
            Focus = focus;
        }
        public void Go()
        {
            if (!Action.IsDisplayed(FindBy))
            {
                Focus.Go(true);
                if (!Action.IsDisplayed(FindBy))
                {
                    if (ParentMenu != null)
                        ParentMenu.Go();
                   
                }
            }
            Action.Click(FindBy);
        }
    }
}
